 <?php
	require_once("includes/db_connection.php");
	require_once("includes/functions.php");
	include("includes/header.php");
	
	$owner_id = $_POST['user_id'];
	$title = mysql_real_escape_string($_POST['title']);
	$content = mysql_real_escape_string($_POST['content']);
	
	$query = "INSERT INTO complaint (
				owner_id, title, content
				) VALUES (
				'$owner_id', '$title', '$content'
				)";
	$result = mysql_query($query, $connection);
?>

<table id="structure">
	<tr>
		<td id="navigation">
			<?php
				main_navigation();
			?>
		</td>
		<td id="page">
			<?php
			
			if ($result) {
				echo "<h2>Reklamacja dodana!</h2>";
				echo "<p><a href=\"panel.php?action=reklamacje\">Przejdz do listy reklamacji</a></p>";
			} else {
				echo "Blad dodawania reklamacji<br />";
				echo mysql_error();
			}
			
			?>
		</td>
	</tr>
</table>
<?php require("includes/footer.php"); ?>
